<template>
	<basic-table
		:pageMethod="
			(params) => {
				params.search = searchValue;
				params.type = 'HorizonDaas'
				return $pandaApi.getDesktopPools(params);
			}
		"
	>
		<template #table-options="tableSlotData">
			<div class="table-left-options">
				<el-button class="icon-button setting-button" @click="createTask()" style="width: auto;margin-right:10px">
					<i class="iconfont iconzhongyiicon_guanji-zhongqi" style="font-size: 12px; margin-right: 5px;"></i>
					<span style="font-size: 12px;">创建</span>
				</el-button>
				<el-button class="icon-button setting-button" :disabled="tableSlotData.table.selectRows.length === 0" style="width: auto;margin-right:10px">
					<i class="iconfont iconzhongyiicon_qiangzhizhongqi" style="font-size: 12px; margin-right: 5px;"></i>
					<span style="font-size: 12px;">批量删除</span>
				</el-button>
			</div>
			<div class="table-right-options">
				<el-input
					placeholder="按任务名称搜索"
					v-model="searchValue"
					@keyup.enter.native="tableSearchChange(tableSlotData)"
					style="width:200px"
				>
				</el-input>
				<el-button @click="tableSlotData.table.refresh" type="primary" style="margin-left: 10px;" >{{ $t('common.search') }}</el-button>
			</div>
		</template>
		<template #table-column="tableSlotData">
			<el-table-column
				type="selection"
				width="40"
				align="center"
			></el-table-column>
			<el-table-column
				prop="name"
				label="任务名称"
			>
			</el-table-column>
			<el-table-column
				prop="cpu"
				label="任务"
			>
			</el-table-column>
			<el-table-column prop="occupied_username" label="执行时间">
			</el-table-column>
			<el-table-column prop="description" label="桌面池">
			</el-table-column>
			<el-table-column prop="description" label="激活">
			</el-table-column>
			<el-table-column prop="description" :label="$t('common.description')">
			</el-table-column>
			<el-table-column label="操作" width="180">
				<template #default="props">
					<link-button
						:content="'删除'"
						:size="10"
						:font-size="'12px'"
						style="margin-right: 15px"
					/>
					<link-button
						:content="'编辑'"
						:size="10"
						:font-size="'12px'"
						style="margin-right: 15px"
            @click="createTask(props.row)"
					/>
					<link-button
						:content="'关联'"
						:size="10"
						:font-size="'12px'"
						style="margin-right: 15px"
					/>
				</template>
			</el-table-column>
		</template>
		<template #others-elements="tableSlotData">
			<create-task ref="create" />
		</template>
	</basic-table>
</template>
<script lang="ts">
import Vue from 'vue'
import BasicTable from '../../components/Basic/Table/BasicTable.vue';
import LinkButton from '../../components/Basic/Button/LinkButton.vue';
import CreateTask from './components/creatTaskFormDialog.vue';
export default Vue.extend({
  components: {
    BasicTable,
    LinkButton,
	CreateTask
  },
  data() {
    return {
      loading: false,
      searchValue: ""
    }
  },
  created() {
  },
  methods: {
    createTask(data: any) {
      let obj: any = {};
      obj.data = data;
      (this.$refs['create'] as any).init(obj);
    }
  }
})
</script>
<style lang="scss" scoped>
.page-container {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #EFF1F4;

  .page-header {
    height: 60px;
    background-color: #FFFFFF;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #D9D9D9;

    .page-tile {
      color: #031129;
      font-size: 16px;
      margin-left: 20px;
      display: flex;
      align-items: center;

      .back-button {
        width: 24px;
        height: 24px;
        padding: 0px 6px;
      }

      .iconzhongyiicon_gaojing {
        margin-left: 5px;
      }
    }
  }

  .page-content {
    height: calc(100vh - 110px);
    overflow: hidden;
    flex-grow: 1;

    .content-wrapper {
      padding: 15px;

      .content-info {
        margin-bottom: 20px;

        ::v-deep .el-form-item {
          margin-bottom: 0px;
          margin-right: 40px
        }

        ::v-deep .el-form-item__label, ::v-deep .el-form-item__content {
          color: #999999;
          font-size: 12px;
        }

        ::v-deep .el-form-item__content {
          color: #333333;
        }
      }
    }
  }
}

.table-left-options {
  display: flex;
}

.table-right-options {
  display: flex;

  .setting-button {
    margin-right: 10px;
  }
}
</style>
